<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>OAuth 类</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.oauth-urlencode.html">« oauth_urlencode</a></li>
      <li style="float: right;"><a href="oauth.construct.html">OAuth::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.oauth.html">OAuth</a></li>
    <li>OAuth 类</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.oauth" class="reference">
 <h1 class="title">OAuth 类</h1>
 

 <div class="partintro"><p class="verinfo">(PECL OAuth &gt;= 0.99.1)</p>


  <div class="section" id="oauth.intro">
   <h2 class="title">简介</h2>
   <p class="para">
   此 OAuth 扩展提供一个简单接口使用 OAuth HTTP 规范与数据提供者互动，以便保护私有资源。
   </p>
  </div>


  <div class="section" id="oauth.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">OAuth</strong>
     </span>
     {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
      <var class="varname"><a href="class.oauth.html#oauth.props.debug">$<var class="varname">debug</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.oauth.html#oauth.props.sslchecks">$<var class="varname">sslChecks</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.oauth.html#oauth.props.debuginfo">$<var class="varname">debugInfo</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="oauth.construct.html" class="methodname">__construct</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$consumer_key</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$consumer_secret</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$signature_method</code><span class="initializer"> = <strong><code>OAUTH_SIG_METHOD_HMACSHA1</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$auth_type</code><span class="initializer"> = 0</span></span><br>)</div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.destruct.html" class="methodname">__destruct</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.disabledebug.html" class="methodname">disableDebug</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.disableredirects.html" class="methodname">disableRedirects</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.disablesslchecks.html" class="methodname">disableSSLChecks</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.enabledebug.html" class="methodname">enableDebug</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.enableredirects.html" class="methodname">enableRedirects</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.enablesslchecks.html" class="methodname">enableSSLChecks</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.fetch.html" class="methodname">fetch</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$protected_resource_url</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$extra_parameters</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$http_method</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$http_headers</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.generatesignature.html" class="methodname">generateSignature</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$http_method</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$url</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$extra_parameters</code><span class="initializer"> = ?</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getaccesstoken.html" class="methodname">getAccessToken</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$access_token_url</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$auth_session_handle</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$verifier_token</code><span class="initializer"> = ?</span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getcapath.html" class="methodname">getCAPath</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getlastresponse.html" class="methodname">getLastResponse</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getlastresponseheaders.html" class="methodname">getLastResponseHeaders</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getlastresponseinfo.html" class="methodname">getLastResponseInfo</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getrequestheader.html" class="methodname">getRequestHeader</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$http_method</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$url</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$extra_parameters</code><span class="initializer"> = ?</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.getrequesttoken.html" class="methodname">getRequestToken</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$request_token_url</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$callback_url</code><span class="initializer"> = ?</span></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setauthtype.html" class="methodname">setAuthType</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$auth_type</code></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setcapath.html" class="methodname">setCAPath</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$ca_path</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ca_info</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setnonce.html" class="methodname">setNonce</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$nonce</code></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setrequestengine.html" class="methodname">setRequestEngine</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$reqengine</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setrsacertificate.html" class="methodname">setRSACertificate</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$cert</code></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setsslchecks.html" class="methodname">setSSLChecks</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$sslcheck</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.settimestamp.html" class="methodname">setTimestamp</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$timestamp</code></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.settoken.html" class="methodname">setToken</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$token</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$token_secret</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="oauth.setversion.html" class="methodname">setVersion</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$version</code></span>): <span class="type">bool</span></div>

   }</div>


  </div>

  <div class="section" id="oauth.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="oauth.props.debug"><var class="varname">debug</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="oauth.props.sslchecks"><var class="varname">sslChecks</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="oauth.props.debuginfo"><var class="varname">debugInfo</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
   </dl>

  </div>

 </div>

 











































































































































































































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="oauth.construct.html">OAuth::__construct</a> — 新建一个 OAuth 对象</li><li><a href="oauth.destruct.html">OAuth::__destruct</a> — 析构函数</li><li><a href="oauth.disabledebug.html">OAuth::disableDebug</a> — 关闭详细的调试</li><li><a href="oauth.disableredirects.html">OAuth::disableRedirects</a> — 关闭重定向</li><li><a href="oauth.disablesslchecks.html">OAuth::disableSSLChecks</a> — 关闭 SSL 检查</li><li><a href="oauth.enabledebug.html">OAuth::enableDebug</a> — 启用详细调试</li><li><a href="oauth.enableredirects.html">OAuth::enableRedirects</a> — 启用重定向</li><li><a href="oauth.enablesslchecks.html">OAuth::enableSSLChecks</a> — 启用 SSL 检查</li><li><a href="oauth.fetch.html">OAuth::fetch</a> — 获取一个 OAuth 受保护的资源</li><li><a href="oauth.generatesignature.html">OAuth::generateSignature</a> — 生成一个签名</li><li><a href="oauth.getaccesstoken.html">OAuth::getAccessToken</a> — 获取一个访问令牌</li><li><a href="oauth.getcapath.html">OAuth::getCAPath</a> — 获取 CA 信息</li><li><a href="oauth.getlastresponse.html">OAuth::getLastResponse</a> — 获取最后一次的响应</li><li><a href="oauth.getlastresponseheaders.html">OAuth::getLastResponseHeaders</a> — 获取最后一次响应的头信息</li><li><a href="oauth.getlastresponseinfo.html">OAuth::getLastResponseInfo</a> — 获取关于最后一次响应的 HTTP 信息</li><li><a href="oauth.getrequestheader.html">OAuth::getRequestHeader</a> — 生成 OAuth 头信息字符串签名</li><li><a href="oauth.getrequesttoken.html">OAuth::getRequestToken</a> — 获取一个请求令牌</li><li><a href="oauth.setauthtype.html">OAuth::setAuthType</a> — 设置授权类型</li><li><a href="oauth.setcapath.html">OAuth::setCAPath</a> — 设置 CA 路径和信息</li><li><a href="oauth.setnonce.html">OAuth::setNonce</a> — 为后续请求设置现时标志</li><li><a href="oauth.setrequestengine.html">OAuth::setRequestEngine</a> — 设置目标请求引擎</li><li><a href="oauth.setrsacertificate.html">OAuth::setRSACertificate</a> — 设置 RSA 证书</li><li><a href="oauth.setsslchecks.html">OAuth::setSSLChecks</a> — 调整特定的SSL请求检查</li><li><a href="oauth.settimestamp.html">OAuth::setTimestamp</a> — 设置时间戳</li><li><a href="oauth.settoken.html">OAuth::setToken</a> — 设置令牌和 secret</li><li><a href="oauth.setversion.html">OAuth::setVersion</a> — 设置 OAuth 版本</li></ul>
</div>
</div></div></body></html>